﻿using Model.BusinessModel.OutPut;
using Model.BusinessModel.OutPut.sys;
using Model.DomainModel.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure.IRepository.Sys
{
    /// <summary>
    /// 用户服务仓储接口
    /// </summary>
    public interface ISysUserRepository : IRepository<SysUser>
    {
        /// <summary>
        /// 根据条件获取用户
        /// </summary>
        /// <param name="corporationKey">公司key</param>
        /// <param name="departmentId">部门key</param>
        /// <param name="authWhere">权限条件</param>
        /// <returns></returns>
        List<SysUserOutPut> GetUser(string corporationKey, string? departmentId,string authWhere);

        /// <summary>
        /// 根据用户名称和密码获取用户信息
        /// </summary>
        /// <param name="userName">用户名称</param>
        /// <param name="password">用户密码</param>
        /// <param name="corporationKey">公司编码</param>
        /// <returns></returns>
        SysUser? GetUserMsg(string userName, string password, string corporationKey);

        /// <summary>
        /// 根据用户名称获取数据
        /// </summary>
        /// <param name="corporationKey">公司key</param>
        /// <param name="userName">用户名称</param>
        /// <returns></returns>
        SysUser? GetUserByName(string corporationKey, string userName);

        /// <summary>
        /// 根据部门id集合获取人员
        /// </summary>
        /// <param name="ids">部门id集合</param>
        /// <returns></returns>
        List<SysUser> GetUserByDepId(List<string> ids);

        /// <summary>
        /// 设置用户的部门
        /// </summary>
        /// <param name="userIds">用户集合</param>
        /// <param name="depId">部门ID</param>
        void SetUserDep(List<string> userIds, string depId);

        /// <summary>
        /// 设置用户是否启用
        /// </summary>
        /// <param name="keys">key集合</param>
        /// <param name="isOpen">是否启用</param>
        void SetUserIsOpen(List<string> keys, bool isOpen);

        /// <summary>
        /// 获取公司人员
        /// </summary>
        /// <param name="corporationKey">公司key</param>
        /// <returns></returns>
        List<TreeOutPut> GetCorporationUser(string corporationKey);

        /// <summary>
        /// 根据公司key,获取用户
        /// </summary>
        /// <param name="corporationKey">公司key</param>
        /// <returns></returns>
        List<SysUser> GetUserByCorporationKey(string corporationKey);
    }
}
